package at.fhhagenberg.mcm09.elevator.control;

import java.rmi.RemoteException;

import sqelevator.IElevator;

public class ElevatorAdapter {

	
	private int m_elevatorID;
	private IElevator m_elevator;
	
	public ElevatorAdapter(IElevator _interface){
		
		m_elevator 	= _interface;
		m_elevatorID 	= 0;
	}
	

	public void setElevatorID(int _id){
		
		m_elevatorID = _id;
	}
	
	public int getSpeed()throws RemoteException{
			
		return m_elevator.getElevatorSpeed(m_elevatorID);
	}


	public void gotoFloor(int _floor) throws RemoteException{
		
		//if(!getDoorClosed()){
			m_elevator.setTarget(m_elevatorID, _floor);
		//}
	}
	
	public int getTargetFloor() throws RemoteException{
		return m_elevator.getTarget(m_elevatorID);
	}
	
	public long getClockTick() throws RemoteException{
		
		return m_elevator.getClockTick();
	}
	
	
	public boolean getDoorClosed() throws RemoteException{
		if(m_elevator.getElevatorDoorStatus(m_elevatorID) == 2){
			return true;
		}else{
			return false;
		}
	}


	public float getLoad() throws RemoteException {
		// TODO Auto-generated method stub
		return m_elevator.getElevatorWeight(m_elevatorID);
	}


	public int getDirection() throws RemoteException {
		
		return m_elevator.getCommittedDirection(m_elevatorID);
	}


	public int getFloorNum() throws RemoteException {
		
		return m_elevator.getFloorNum();
	}


	public boolean getElevatorBotton(int _floor) throws RemoteException {
		
		return m_elevator.getElevatorButton(m_elevatorID, _floor);
	}



	public boolean getFloorButtonDown(int _floor) throws RemoteException {
		
		return m_elevator.getFloorButtonDown(_floor);
	}


	public boolean getFloorButtonUp(int _floor) throws RemoteException {
		
		return m_elevator.getFloorButtonUp(_floor);
	}




	public int getPosition() throws RemoteException {
		
		return m_elevator.getElevatorFloor(m_elevatorID);
	}
}
